/*
 * Copyright (c) 2016 zhangcm. All Rights Reserved.
 */
package com.jnzc.ocr.serv.shop.api.impl;

import com.jnzc.ocr.common.bean.PageResult;
import com.jnzc.ocr.common.utils.ValidateUtils;
import com.jnzc.ocr.serv.shop.api.ShopSupplierApi;
import com.jnzc.ocr.serv.shop.entity.ShopSupplier;
import com.jnzc.ocr.serv.shop.entity.ShopSupplier;
import com.jnzc.ocr.serv.shop.filter.ShopSupplierFilter;
import com.jnzc.ocr.serv.shop.service.ShopSupplierService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhangcm
 * @version 1.0, 2017/9/13
 */
@RestController
public class ShopSupplierApiImpl implements ShopSupplierApi {

    @Autowired
    private ShopSupplierService shopSupplierService;

    @Override
    public ShopSupplier find(@RequestParam("id") Long id, @RequestParam("shopId") Long shopId) {
        return shopSupplierService.find(id, shopId);
    }

    @Override
    public PageResult<ShopSupplier> search(@RequestBody ShopSupplierFilter filter, @RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize) {
        return shopSupplierService.search(filter, pageNo, pageSize);
    }

    @Override
    public ShopSupplier save(@RequestBody ShopSupplier obj) {
        return shopSupplierService.save(obj);
    }

    @Override
    public void delete(@RequestParam("id") Long id, @RequestParam("shopId") Long shopId) {
        ShopSupplier obj = find(id, shopId);
        shopSupplierService.delete(id);
    }
}
